[pull] main from Shopify:main - #210
Merged
Merged
Conversation
* feat: typed JSI bindings infra + JsiVideo/JsiSkFont exemplars Phase-2 wave 1 of the NativeObject migration: convert raw JSI_HOST_FUNCTION method bodies to typed C++ signatures converted through rnwgpu::JSIConverter. - Add cpp/api/JsiSkConverters.h: JSIConverter specializations for wrapped Skia pointer types (sk_sp<T>, std::shared_ptr<T>) keyed on a JsiSkWrapperFor<T> trait, delegating to each wrapper's fromValue so plain-object fallbacks keep working. Value converters for SkRect, SkPoint, SkMatrix (fromJSI only) and SkISize. All converters are partial specializations so bodies instantiate lazily and headers stay cycle-free. - Add installChainableMethod to JsiSkNativeObject for methods returning this. - Qualify fromValue lookup in NativeObject typed installers as NativeObject<Derived>::fromValue: RNSkia wrappers shadow fromValue with a public static returning the wrapped inner object. - Convert JsiVideo (all methods typed) and JsiSkFont (typed except getMetrics, which keeps a conditionally-present bounds property) as the reference pattern. * feat: typed bindings for simple factories Wave 2: convert JsiSkColorFilterFactory, JsiSkMaskFilterFactory, JsiSkPathEffectFactory, JsiSkTextBlobFactory, JsiSkTypefaceFactory, JsiSkFontMgrFactory, JsiSkRuntimeEffectFactory and JsiSkDataFactory::fromBase64 to typed signatures. Converter additions: JsiColor strong typedef (SkColor is a uint32_t typedef, so colors need their own argument type), SkRSXform value converter, and JsiOptional<T> (omitted | undefined | null all treated as absent, matching the hasOptionalArgument pattern of the raw bindings). JsiSkFont::getGlyphIDs and MakeDash switch to JsiOptional accordingly. Still raw (cannot be typed): JsiSkDataFactory::fromURI (returns a promise built from the runtime), fromBytes (typed-array introspection), JsiSkPictureFactory::MakePicture (heterogeneous argument dispatch). * feat: typed bindings for image filter and shader factories Wave 3: convert JsiSkImageFilterFactory and JsiSkShaderFactory to typed signatures using JsiOptional for the pervasive optional input-filter/crop-rect/local-matrix arguments, plus a SkPoint3 converter for lighting filters. This also fixes a latent dangling pointer in the gradient factories: getLocalMatrix() returned the raw pointer of a temporary std::shared_ptr<SkMatrix>, which dangled when the matrix came from the plain-array fallback; the typed signatures keep the shared_ptr alive for the whole call. * feat: typed bindings for path, image and surface factories Wave 4: convert JsiSkPathFactory (all methods except Stroke, whose options object is read leniently property by property), JsiSkPathBuilderFactory, JsiSkAnimatedImageFactory, JsiSkTypefaceFontProviderFactory, and the typeable parts of JsiSkImageFactory (MakeNull, MakeImageFromEncoded, MakeImageFromNativeBuffer, MakeImage) and JsiSkSurfaceFactory (Make). Still raw: image factory promise/texture methods (MakeImageFromViewTag, MakeImageFromNativeTextureUnstable, MakeImageFromTexture, MakeTextureFromImage), SurfaceFactory::MakeOffscreen (options object), and JsiSkSVGFactory (lenient fontMgr/asset-map parsing). * feat: typed bindings for small instance classes Wave 5: convert JsiSkRect, JsiSkPoint and JsiSkRRect (typed getters via installGetter, which keeps them enumerable so the generic toJSON keeps working), JsiSkPicture::makeShader, JsiSkAnimatedImage, JsiSkRuntimeShaderBuilder, JsiSkSVG, JsiSkFontMgr, JsiSkTypefaceFontProvider, JsiSkContourMeasure, JsiSkContourMeasureIter (next returns std::optional so the JS result stays undefined, not null), JsiSkVertices and JsiSkTypeface. Still raw: JsiSkPicture::serialize (constructs a Uint8Array). * feat: typed bindings for JsiSkMatrix and JsiSkPaint Wave 6: JsiSkMatrix converts to typed chainable methods via the new installChainableMethod (the JS functions still return this); concat keeps accepting both Matrix wrappers and plain 9/16-element arrays through the shared_ptr<SkMatrix> converter. JsiSkPaint converts fully: colors go through the JsiColor strong typedef, and the nullable setShader/setColorFilter/setImageFilter/setMaskFilter/setPathEffect arguments use JsiOptional (null | undefined clear the effect, as before).
* feat: typed JSI bindings infra + JsiVideo/JsiSkFont exemplars Phase-2 wave 1 of the NativeObject migration: convert raw JSI_HOST_FUNCTION method bodies to typed C++ signatures converted through rnwgpu::JSIConverter. - Add cpp/api/JsiSkConverters.h: JSIConverter specializations for wrapped Skia pointer types (sk_sp<T>, std::shared_ptr<T>) keyed on a JsiSkWrapperFor<T> trait, delegating to each wrapper's fromValue so plain-object fallbacks keep working. Value converters for SkRect, SkPoint, SkMatrix (fromJSI only) and SkISize. All converters are partial specializations so bodies instantiate lazily and headers stay cycle-free. - Add installChainableMethod to JsiSkNativeObject for methods returning this. - Qualify fromValue lookup in NativeObject typed installers as NativeObject<Derived>::fromValue: RNSkia wrappers shadow fromValue with a public static returning the wrapped inner object. - Convert JsiVideo (all methods typed) and JsiSkFont (typed except getMetrics, which keeps a conditionally-present bounds property) as the reference pattern. * feat: typed bindings for simple factories Wave 2: convert JsiSkColorFilterFactory, JsiSkMaskFilterFactory, JsiSkPathEffectFactory, JsiSkTextBlobFactory, JsiSkTypefaceFactory, JsiSkFontMgrFactory, JsiSkRuntimeEffectFactory and JsiSkDataFactory::fromBase64 to typed signatures. Converter additions: JsiColor strong typedef (SkColor is a uint32_t typedef, so colors need their own argument type), SkRSXform value converter, and JsiOptional<T> (omitted | undefined | null all treated as absent, matching the hasOptionalArgument pattern of the raw bindings). JsiSkFont::getGlyphIDs and MakeDash switch to JsiOptional accordingly. Still raw (cannot be typed): JsiSkDataFactory::fromURI (returns a promise built from the runtime), fromBytes (typed-array introspection), JsiSkPictureFactory::MakePicture (heterogeneous argument dispatch). * feat: typed bindings for image filter and shader factories Wave 3: convert JsiSkImageFilterFactory and JsiSkShaderFactory to typed signatures using JsiOptional for the pervasive optional input-filter/crop-rect/local-matrix arguments, plus a SkPoint3 converter for lighting filters. This also fixes a latent dangling pointer in the gradient factories: getLocalMatrix() returned the raw pointer of a temporary std::shared_ptr<SkMatrix>, which dangled when the matrix came from the plain-array fallback; the typed signatures keep the shared_ptr alive for the whole call. * feat: typed bindings for path, image and surface factories Wave 4: convert JsiSkPathFactory (all methods except Stroke, whose options object is read leniently property by property), JsiSkPathBuilderFactory, JsiSkAnimatedImageFactory, JsiSkTypefaceFontProviderFactory, and the typeable parts of JsiSkImageFactory (MakeNull, MakeImageFromEncoded, MakeImageFromNativeBuffer, MakeImage) and JsiSkSurfaceFactory (Make). Still raw: image factory promise/texture methods (MakeImageFromViewTag, MakeImageFromNativeTextureUnstable, MakeImageFromTexture, MakeTextureFromImage), SurfaceFactory::MakeOffscreen (options object), and JsiSkSVGFactory (lenient fontMgr/asset-map parsing). * feat: typed bindings for small instance classes Wave 5: convert JsiSkRect, JsiSkPoint and JsiSkRRect (typed getters via installGetter, which keeps them enumerable so the generic toJSON keeps working), JsiSkPicture::makeShader, JsiSkAnimatedImage, JsiSkRuntimeShaderBuilder, JsiSkSVG, JsiSkFontMgr, JsiSkTypefaceFontProvider, JsiSkContourMeasure, JsiSkContourMeasureIter (next returns std::optional so the JS result stays undefined, not null), JsiSkVertices and JsiSkTypeface. Still raw: JsiSkPicture::serialize (constructs a Uint8Array). * feat: typed bindings for JsiSkMatrix and JsiSkPaint Wave 6: JsiSkMatrix converts to typed chainable methods via the new installChainableMethod (the JS functions still return this); concat keeps accepting both Matrix wrappers and plain 9/16-element arrays through the shared_ptr<SkMatrix> converter. JsiSkPaint converts fully: colors go through the JsiColor strong typedef, and the nullable setShader/setColorFilter/setImageFilter/setMaskFilter/setPathEffect arguments use JsiOptional (null | undefined clear the effect, as before). * feat: typed bindings for image, surface, runtime effect and skottie Convert the remaining instance classes to typed signatures: - JsiSkImage: width/height, getImageInfo, makeShaderOptions/Cubic, makeNonTextureImage, isTextureBacked, encodeToBase64 (nullable string via a new variant<nullptr_t, string> converter). encodeImageData takes typed optional format/quality; encodeToBytes stays raw (Uint8Array) and builds the optionals itself; readPixels and getNativeTextureUnstable stay raw. - JsiSkImageInfo and JsiSkRSXform: typed getters (and RSXform::set). - JsiSkSurface: width/height, getCanvas, flush; makeImageSnapshot stays raw (may return the recycled image argument itself). - JsiSkRuntimeEffect: fully typed; castUniforms now takes the converted vector, getUniform returns RuntimeEffectUniform via a dedicated toJSI-only converter. - JsiSkSkottie: typed except the prop/slot getters that build heterogeneous objects (getSlotInfo, getColorSlot, getVec2Slot, getTextSlot, get*Props). The count-guard methods keep returning false on missing arguments via JsiOptional parameters. New SkSize toJSI converter preserves the fractional size() result. JsiSkData has no methods and needs no change. Behavior notes: error strings for wrong argument types change (std::runtime_error instead of jsi::JSError), and encode quality now throws on non-number values instead of silently using 100.
* feat: typed JSI bindings infra + JsiVideo/JsiSkFont exemplars
Phase-2 wave 1 of the NativeObject migration: convert raw JSI_HOST_FUNCTION
method bodies to typed C++ signatures converted through rnwgpu::JSIConverter.
- Add cpp/api/JsiSkConverters.h: JSIConverter specializations for wrapped
Skia pointer types (sk_sp<T>, std::shared_ptr<T>) keyed on a
JsiSkWrapperFor<T> trait, delegating to each wrapper's fromValue so
plain-object fallbacks keep working. Value converters for SkRect, SkPoint,
SkMatrix (fromJSI only) and SkISize. All converters are partial
specializations so bodies instantiate lazily and headers stay cycle-free.
- Add installChainableMethod to JsiSkNativeObject for methods returning this.
- Qualify fromValue lookup in NativeObject typed installers as
NativeObject<Derived>::fromValue: RNSkia wrappers shadow fromValue with a
public static returning the wrapped inner object.
- Convert JsiVideo (all methods typed) and JsiSkFont (typed except
getMetrics, which keeps a conditionally-present bounds property) as the
reference pattern.
* feat: typed bindings for simple factories
Wave 2: convert JsiSkColorFilterFactory, JsiSkMaskFilterFactory,
JsiSkPathEffectFactory, JsiSkTextBlobFactory, JsiSkTypefaceFactory,
JsiSkFontMgrFactory, JsiSkRuntimeEffectFactory and
JsiSkDataFactory::fromBase64 to typed signatures.
Converter additions: JsiColor strong typedef (SkColor is a uint32_t
typedef, so colors need their own argument type), SkRSXform value
converter, and JsiOptional<T> (omitted | undefined | null all treated as
absent, matching the hasOptionalArgument pattern of the raw bindings).
JsiSkFont::getGlyphIDs and MakeDash switch to JsiOptional accordingly.
Still raw (cannot be typed): JsiSkDataFactory::fromURI (returns a
promise built from the runtime), fromBytes (typed-array introspection),
JsiSkPictureFactory::MakePicture (heterogeneous argument dispatch).
* feat: typed bindings for image filter and shader factories
Wave 3: convert JsiSkImageFilterFactory and JsiSkShaderFactory to typed
signatures using JsiOptional for the pervasive optional
input-filter/crop-rect/local-matrix arguments, plus a SkPoint3 converter
for lighting filters.
This also fixes a latent dangling pointer in the gradient factories:
getLocalMatrix() returned the raw pointer of a temporary
std::shared_ptr<SkMatrix>, which dangled when the matrix came from the
plain-array fallback; the typed signatures keep the shared_ptr alive for
the whole call.
* feat: typed bindings for path, image and surface factories
Wave 4: convert JsiSkPathFactory (all methods except Stroke, whose
options object is read leniently property by property),
JsiSkPathBuilderFactory, JsiSkAnimatedImageFactory,
JsiSkTypefaceFontProviderFactory, and the typeable parts of
JsiSkImageFactory (MakeNull, MakeImageFromEncoded,
MakeImageFromNativeBuffer, MakeImage) and JsiSkSurfaceFactory (Make).
Still raw: image factory promise/texture methods (MakeImageFromViewTag,
MakeImageFromNativeTextureUnstable, MakeImageFromTexture,
MakeTextureFromImage), SurfaceFactory::MakeOffscreen (options object),
and JsiSkSVGFactory (lenient fontMgr/asset-map parsing).
* feat: typed bindings for small instance classes
Wave 5: convert JsiSkRect, JsiSkPoint and JsiSkRRect (typed getters via
installGetter, which keeps them enumerable so the generic toJSON keeps
working), JsiSkPicture::makeShader, JsiSkAnimatedImage,
JsiSkRuntimeShaderBuilder, JsiSkSVG, JsiSkFontMgr,
JsiSkTypefaceFontProvider, JsiSkContourMeasure, JsiSkContourMeasureIter
(next returns std::optional so the JS result stays undefined, not null),
JsiSkVertices and JsiSkTypeface.
Still raw: JsiSkPicture::serialize (constructs a Uint8Array).
* feat: typed bindings for JsiSkMatrix and JsiSkPaint
Wave 6: JsiSkMatrix converts to typed chainable methods via the new
installChainableMethod (the JS functions still return this); concat
keeps accepting both Matrix wrappers and plain 9/16-element arrays
through the shared_ptr<SkMatrix> converter. JsiSkPaint converts fully:
colors go through the JsiColor strong typedef, and the nullable
setShader/setColorFilter/setImageFilter/setMaskFilter/setPathEffect
arguments use JsiOptional (null | undefined clear the effect, as
before).
* feat: typed bindings for image, surface, runtime effect and skottie
Convert the remaining instance classes to typed signatures:
- JsiSkImage: width/height, getImageInfo, makeShaderOptions/Cubic,
makeNonTextureImage, isTextureBacked, encodeToBase64 (nullable string
via a new variant<nullptr_t, string> converter). encodeImageData takes
typed optional format/quality; encodeToBytes stays raw (Uint8Array)
and builds the optionals itself; readPixels and
getNativeTextureUnstable stay raw.
- JsiSkImageInfo and JsiSkRSXform: typed getters (and RSXform::set).
- JsiSkSurface: width/height, getCanvas, flush; makeImageSnapshot stays
raw (may return the recycled image argument itself).
- JsiSkRuntimeEffect: fully typed; castUniforms now takes the converted
vector, getUniform returns RuntimeEffectUniform via a dedicated
toJSI-only converter.
- JsiSkSkottie: typed except the prop/slot getters that build
heterogeneous objects (getSlotInfo, getColorSlot, getVec2Slot,
getTextSlot, get*Props). The count-guard methods keep returning false
on missing arguments via JsiOptional parameters. New SkSize toJSI
converter preserves the fractional size() result.
JsiSkData has no methods and needs no change.
Behavior notes: error strings for wrong argument types change
(std::runtime_error instead of jsi::JSError), and encode quality now
throws on non-number values instead of silently using 100.
* feat: typed bindings for JsiSkPath and JsiSkPathBuilder
Convert the two chainable-heavy path classes:
- Add installChainableMethodWithRuntime for chainable methods that need
the calling runtime; the deprecated JsiSkPath mutators use it so they
keep logging their JS-console deprecation warning while returning
this for chaining.
- JsiSkPathBuilder converts fully via installChainableMethod; every
query and build method is typed.
- JsiSkPath converts fully except stroke(), whose options object is
read leniently property by property.
- SkPoint gets its own converter with a toJSI producing a plain {x, y}
object (what the raw getLastPt bindings returned, not a Point
wrapper); toCmds returns its command list as vector<vector<double>>.
Note: Path.equals keeps the pre-existing quirk of comparing its two
arguments rather than this against one argument (the TS interface
declares equals(other), so the documented one-argument call was already
broken in the native binding before this change).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )